package com.tb.toolkit;

import com.alibaba.fastjson.JSON;
import com.tb.util.DateUtils;
import com.tb.util.RegexpUtils;

import java.util.Date;

/**
 * comment
 *
 * @author zhao yuan
 * @since 2018/10/9
 */
public class Test {
    public static void main(String[] args) {
        Date date = DateUtils.parserDate("201800-07-01 15:30:30","yyyy-MM-dd HH:mm:ss");
        String d = DateUtils.format(date, "yyyy-MM-dd HH:mm:ss");
        String s1 = RegexpUtils.matchValue("(\\d{4})\\d*", d, 1);
        String s = d.replaceAll("(\\d{4})\\d*", s1);
        Date date1 = DateUtils.parserDate(s, "yyyy-MM-dd HH:mm:ss");
        System.out.println(DateUtils.format(date1));
    }
}
